<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateAuthTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('auth', function (Blueprint $table) {
            $table->increments('id');
            $table->string('auth_name', 20)->nullable()->default('');//默认为notNull
            $table->string('url')->nullable()->default('');
            $table->string('path')->nullable()->default('')->comment('全路径');
            $table->integer('pid')->nullable()->default('0')->comment('父级id');
            $table->integer('level')->nullable()->default('0')->comment('级别');
            // $table->enum('is_nav', [1, 2])->default('1')->notNull()->comment('作为菜单，1-是，2-否');
            $table->timestamp('created_at')->useCurrent()->nullable();
            $table->timestamp('updated_at')->default(DB::raw('CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP'))->nullable();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('auth');
    }
}
